/**
 ******************************************************************************
 * @file    delay.c
 * @brief   delay program body
 ******************************************************************************
 * @attention
 ******************************************************************************
 */
/* Includes ------------------------------------------------------------------*/
#include "delay.h"

#include "stm32f1xx_hal.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private user code ---------------------------------------------------------*/
/**
 * @brief 秒级延时
 */
void Delay_s(uint32_t s)
{
	HAL_Delay(1000 * s);
}
/**
 * @brief 毫秒级延时
 */
void Delay_ms(uint32_t ms)
{
	HAL_Delay(ms);
}
/**
 * @brief 微秒级延时
 */

void Delay_us(uint32_t us)
{
//	主频72MHz，1us主频工作72个周期
//	耗时代码，一次需要主频5次
	uint32_t temp = us * 5;
	while(temp--)
	{
		__NOP();
		__NOP();
	}
}
